package br.ufrgs.tst.ga.operators;

import java.security.InvalidParameterException;

import junit.framework.Assert;

import org.junit.Before;
import org.junit.Test;

import br.ufrgs.ga.operators.MutationOperator;

public class TestMutationOperator {

	private MutationOperator mutationOperator;
	
	@Before
	public void setUp() {
		mutationOperator = new MutationOperator();
	}
	
	@Test
	public void executeTest() {
		String dnaStrand = "123456";
		String mutatedDnaStrand = mutationOperator.execute(dnaStrand);
		Assert.assertEquals("214365", mutatedDnaStrand);
		
		boolean exceptionHasBeenThrown = false;
		try {
			mutationOperator.execute(null);
		} catch (InvalidParameterException e) {
			exceptionHasBeenThrown = true;
		}
		
		Assert.assertTrue(exceptionHasBeenThrown);
	}
}
